 <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fun"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>开门日志</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="format-detection" content="telephone=no" />
    <script src="${pageContext.request.contextPath}/static/js/KeysManager/index.js"></script>
    <link href="${pageContext.request.contextPath}/static/plugins/layer_mobile/need/layer.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/yahlj-app.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer_mobile/layer.js"></script>
    <link href="${pageContext.request.contextPath}/static/css/KeysManager/OpenLog.css?v=9990" rel="stylesheet"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/plugins/dropload-gh-pages/dropload.css">
    <style type="text/css">
    	.select2{
    		margin-left: 0.42553191rem;
			width: 10rem;
			float: left;
			background-color: #ffffff;
			border:0;
			  /*很关键：将默认的select选择框样式清除*/
		  	appearance:none;
		  	-moz-appearance:none;
		 	-webkit-appearance:none;
			height: 0.85106383rem;
		}
	</style>
</head>
<body>
<c:forEach var="item" items="${datalist}" varStatus="status">
<div class="item">
	<div class="divRow_head"></div>
	<div class="head_main clearfix">
		<div class="divRow_date lf">${item.date}</div>
		<div class="rt">
			<img src="${pageContext.request.contextPath}/static/images/KeysManager/open_door_down.png" class="list_down"/>
			<img style="display:none;" src="${pageContext.request.contextPath}/static/images/KeysManager/open_door_up.png" class="list_up"/>
		</div>
		<c:forEach var="item1" items="${item.list}" >
	<!-- 一个内容	 -->
		<div class="head_content" style="">
		 <div class="divRow">
	        <span class="spanLeft">
	        	<c:if test="${item1.ktype==1}">
	        	访客
	        	</c:if>
	        	<c:if test="${item1.ktype==0}">
	        	${item1.auname}
	        	</c:if>
	        </span>
	        
	         <span class="spanRight"><c:if test="${item1.ktype==0}">${item1.tel}</c:if></span>
        
    </div>
   
    <div class="divRow setFontColor setFontSize">
         <div class="spanLeft">
            <span class="community">
            	${item1.installName}
            </span>
        </div>
        <div class="spanRight">
            <img src="${pageContext.request.contextPath}/static/images/KeysManager/open_door_time.png" class="key-icon"/>
            <span class="details-date">
          ${item1.time_}
            </span>
        </div>
    </div>
	</div>
	</c:forEach>
	</div>
</div>
</c:forEach>
	<c:if test="${fun:length(datalist) == 0}">
		<div class="dropload-noData">
			<img src="${pageContext.request.contextPath}/static/images/KeysManager/no_open_door.png" class="key-icon open_pic"/>
			暂时没有开门日志哦
		</div>
		<!-- style="margin-top: 10rem;font-size: 1rem;text-align: center;width: 100%"  -->
	</c:if>
</body>
</html>
<script>


 $('.head_main').click(function(){
	var img=$(this).find('.rt img').toggleClass('rotate');
	$(this).find(".head_content").toggleClass('show');
});







;(function(window, undefined){
	
	
    var currYear = (new Date()).getFullYear(); // 获取年  
    var currMonth = (new Date()).getMonth(); // 获取月  
    var currDay = (new Date()).getDate(); // 获取日 
 var opt = {
    preset: 'date', //日期
    theme: 'mobiscroll', //皮肤样式
    display: 'modal', //显示方式 
    //mode: 'clickpick', //日期选择模式
    dateFormat: 'yy-mm-dd', // 日期格式
    setText: '确定', //确认按钮名称
    cancelText: '取消',//取消按钮名籍我
    dateOrder: 'yymmdd', //面板中日期排列格式
    startDay: currDay,  
    startMonth: currMonth, // 开始月份  
    startYear: currYear, //开始年份  
    endYear:currYear + 100,
    dayText: '日', monthText: '月', yearText: '年' //面板中年月日文字
    
    
};

/* $('#select-date').mobiscroll(opt); */
	
})(window);

function showMsg(content){
	layer.open({
	    content:content,
	    skin: 'msg',
	    time:2
	});
}

	
function yes(){
	try{
		var tel=$("#tel").val();
		var name=$("#name").val();
		var lockid=$("#lockid").val();
		var date=$("#select-date").val();
		if(!lockid){
			showMsg('请选择钥匙');
			return;
		}
		if(!date){
			showMsg('请填写有效期');
			return;
		}
		if(!tel){
			showMsg('请填写电话');
			return;
		}
		if(!name){
			showMsg('请填写姓名');
			return;
		}
		
		
		$.ajax({   
		    url:'<%=request.getContextPath()%>/admin/tusers_addTestKey.action',   
		    type:'post',
		    data:"&sid="+lockid+"&validity="+date+'tel='+tel+"&userName="+name,   
		    async : true, //默认为true 异步   
		    dataType:'json',
		    error: function(XMLHttpRequest, textStatus, errorThrown) {
		    },  
		    success:function(result){   
		    	var data = result.data;
		       if(result.code=='1'){
		    	   showMsg(result.msg);
		       }else{
		    	   showMsg(result.msg);
		       }
		    }
		});
	}catch (e) {
		showMsg(e.message);
	}
	
	
}


function no(){
	hljJs.closeWindow({
		success:function(res){
			console.log(res);		
		},
		fail:function(res){
			console.log(res);
		}
	});
}
</script>